package com.dalongxin.work.data;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 合同审批和合同评审Bean
 */
public class DjHtps implements Serializable {

    private int id;
    private int projectId;
    private String projectName;
    private int supplierId;
    private String supplierName;
    private String contractNumber;
    private int applyUserId;
    private String applyUserName;
    private String fillDate;
    private String endDate;
    private String contractName;
    private String content;
    private int approveId1;
    private String approveName1;
    private int approveId2;
    private String approveName2;
    private int approveId3;
    private String approveName3;
    private int approveId4;
    private String approveName4;
    private int status;
    private int createId;
    private String createName;
    private String createTime;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getProjectId() {
        return projectId;
    }

    public void setProjectId(int projectId) {
        this.projectId = projectId;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public int getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(int supplierId) {
        this.supplierId = supplierId;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    public String getContractNumber() {
        return contractNumber;
    }

    public void setContractNumber(String contractNumber) {
        this.contractNumber = contractNumber;
    }

    public int getApplyUserId() {
        return applyUserId;
    }

    public void setApplyUserId(int applyUserId) {
        this.applyUserId = applyUserId;
    }

    public String getApplyUserName() {
        return applyUserName;
    }

    public void setApplyUserName(String applyUserName) {
        this.applyUserName = applyUserName;
    }

    public String getFillDate() {
        return fillDate;
    }

    public void setFillDate(String fillDate) {
        this.fillDate = fillDate;
    }

    public String getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    public String getContractName() {
        return contractName;
    }

    public void setContractName(String contractName) {
        this.contractName = contractName;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getApproveId1() {
        return approveId1;
    }

    public void setApproveId1(int approveId1) {
        this.approveId1 = approveId1;
    }

    public String getApproveName1() {
        return approveName1;
    }

    public void setApproveName1(String approveName1) {
        this.approveName1 = approveName1;
    }

    public int getApproveId2() {
        return approveId2;
    }

    public void setApproveId2(int approveId2) {
        this.approveId2 = approveId2;
    }

    public String getApproveName2() {
        return approveName2;
    }

    public void setApproveName2(String approveName2) {
        this.approveName2 = approveName2;
    }

    public int getApproveId3() {
        return approveId3;
    }

    public void setApproveId3(int approveId3) {
        this.approveId3 = approveId3;
    }

    public String getApproveName3() {
        return approveName3;
    }

    public void setApproveName3(String approveName3) {
        this.approveName3 = approveName3;
    }

    public int getApproveId4() {
        return approveId4;
    }

    public void setApproveId4(int approveId4) {
        this.approveId4 = approveId4;
    }

    public String getApproveName4() {
        return approveName4;
    }

    public void setApproveName4(String approveName4) {
        this.approveName4 = approveName4;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getCreateId() {
        return createId;
    }

    public void setCreateId(int createId) {
        this.createId = createId;
    }

    public String getCreateName() {
        return createName;
    }

    public void setCreateName(String createName) {
        this.createName = createName;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public static DjHtps parseFromJson(JSONObject jsonObj) {
        DjHtps object = new DjHtps();
        object.id = jsonObj.optInt("id");
        object.projectId = jsonObj.optInt("projectId");
        object.projectName = jsonObj.optString("projectName");
        object.supplierId = jsonObj.optInt("supplierId");
        object.supplierName = jsonObj.optString("supplierName");
        object.fillDate = jsonObj.optString("fillDate");
        object.endDate = jsonObj.optString("endDate");
        object.contractName = jsonObj.optString("contractName");
        object.contractNumber = jsonObj.optString("contractNumber");
        object.applyUserId = jsonObj.optInt("applyUserId");
        object.applyUserName = jsonObj.optString("applyUserName");
        object.approveId1 = jsonObj.optInt("approveId1");
        object.approveName1 = jsonObj.optString("approveName1");
        object.approveId2 = jsonObj.optInt("approveId2");
        object.approveName2 = jsonObj.optString("approveName2");
        object.approveId3 = jsonObj.optInt("approveId3");
        object.approveName3 = jsonObj.optString("approveName3");
        object.approveId4 = jsonObj.optInt("approveId4");
        object.approveName4 = jsonObj.optString("approveName4");
        object.status = jsonObj.optInt("status");
        object.createId = jsonObj.optInt("createId");
        object.createName = jsonObj.optString("createName");
        object.createTime = jsonObj.optString("createTime");
        object.contractName = jsonObj.optString("contractName");
        object.content = jsonObj.optString("content");
        return object;
    }

    public static List<DjHtps> parseFromJsonList(JSONArray jsonArray) {
        List<DjHtps> list = new ArrayList<>();
        if(jsonArray != null && jsonArray.length() > 0) {
            for(int i=0;i<jsonArray.length();i++) {
                DjHtps item = parseFromJson(jsonArray.optJSONObject(i));
                if(item != null)list.add(item);
            }
        }
        return list;
    }
}
